/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ditt.web;

import javax.swing.*;
import java.awt.event.*;

/**
 *
 * @author shonak
 */
public class JAppletBienvenue extends JApplet {

    /**
     * Initialization method that will be called after the applet is loaded into
     * the browser.
     */
    private javax.swing.Timer timer;
    public void init() {
      
      final JLabel  lblBienvenue = new JLabel(getParameter("mess"));
      
      lblBienvenue.setLocation(0, this.getHeight());
      lblBienvenue.setSize(lblBienvenue.getPreferredSize());
       this.getContentPane().setLayout(null);
       
       this.getContentPane().add(lblBienvenue);
       
       
       
       ActionListener listenerApplet = new ActionListener(){
          
            public void actionPerformed(ActionEvent e){
                
                int y  = lblBienvenue.getY();
                if(y< -1)
                    y = getHeight();
                else
                    y -= 1;
                
                lblBienvenue.setLocation(lblBienvenue.getX(), y);
            }
           
       };
       
       timer = new Timer(50,listenerApplet);
       
    }
    
    public void start(){
        timer.start();
    }
    
    public void stop(){
        timer.stop();
    }
}
